asm
  ld sp,$1CFF
  end asm

#include "./library/pacmandelay.bas"
#include "./library/smsrnd.bas"

dim eee as uinteger at $1C10
dim seed as uinteger at $1C12
dim ee0 as uinteger at $1C14
dim ee1 as uinteger at $1C16
dim ee2 as uinteger at $1C18
dim ee3 as uinteger at $1C1A
dim eex as uinteger at $1C1C
dim eey as uinteger at $1C1E


sub warpspeedputchar(tx1 as uinteger, ty1 as uinteger, tch1 as ubyte)
  poke $1900+(ty1*32)+tx1,tch1+32
  end sub

for eee=$1800 to $1BFF
  poke eee,$0E
  next

for ee0=0 to 23
  for ee1=4 to 31
    seed=smsrnd(seed)
    warpspeedputchar(ee1,ee0,$5B+(seed mod 5))
    next:next

for ee0=0 to 7
  for ee1=0 to 7
    warpspeedputchar(ee1+23,ee0+15,ee1+ee0*8+32)
    next:next


eee=0

do
  warpspeedputchar(5,1,48+(int(eee/10000) mod 10))  
  warpspeedputchar(6,1,48+(int(eee/1000) mod 10))
  warpspeedputchar(7,1,48+(int(eee/100) mod 10))  
  warpspeedputchar(8,1,48+(int(eee/10) mod 10))
  warpspeedputchar(9,1,48+(eee mod 10))

  ee0=255-in(0)
  warpspeedputchar(28,1,48+(int(ee0/100) mod 10))  
  warpspeedputchar(29,1,48+(int(ee0/10) mod 10))
  warpspeedputchar(30,1,48+(ee0 mod 10))
  ee1=ee0

  ee0=63-in(1)
  warpspeedputchar(28,2,48+(int(ee0/100) mod 10))  
  warpspeedputchar(29,2,48+(int(ee0/10) mod 10))
  warpspeedputchar(30,2,48+(ee0 mod 10))
  ee2=ee0

  ee0=in(2)
  warpspeedputchar(28,3,48+(int(ee0/100) mod 10))  
  warpspeedputchar(29,3,48+(int(ee0/10) mod 10))
  warpspeedputchar(30,3,48+(ee0 mod 10))

  ee0=in(3)
  warpspeedputchar(28,4,48+(int(ee0/100) mod 10))  
  warpspeedputchar(29,4,48+(int(ee0/10) mod 10))
  warpspeedputchar(30,4,48+(ee0 mod 10))

  eex=int(ee1/2)
  eey=int((ee2*3)/8)

  warpspeedputchar(eex,eey,eee)

  eee=eee+1
  loop






'static ADDRESS_MAP_START( warpspeed_map, AS_PROGRAM, 8, warpspeed_state )
'AM_RANGE(0x0000, 0x0dff) AM_ROM
'AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(vidram_w ) AM_SHARE("videoram")
'AM_RANGE(0x1c00, 0x1cff) AM_RAM AM_SHARE("workram")
'ADDRESS_MAP_END
'static ADDRESS_MAP_START ( warpspeed_io_map, AS_IO, 8, warpspeed_state )
'ADDRESS_MAP_GLOBAL_MASK(0xff)
'AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
'AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
'AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW")
'AM_RANGE(0x03, 0x03) AM_READ_PORT("IN2")
'AM_RANGE(0x00, 0x27) AM_WRITE(hardware_w )
'ADDRESS_MAP_END






